package com.itxckf.service.impl;


import com.itxckf.mapper.OrderMapper;
import com.itxckf.pojo.DeleteOrderProductsFrom;
import com.itxckf.pojo.Order;
import com.itxckf.pojo.OrderProducts;
import com.itxckf.pojo.Products;
import com.itxckf.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;
    @Override
    public List<Order> getOrder(String name,String sts) {
        return orderMapper.getOrder(name,sts);
    }

    @Override
    public void updateOrder(Order order) {
        orderMapper.updateOrder(order);
    }

    @Override
    public List<Products> getOrderProducts(int orderID) {
        return orderMapper.getOrderProducts(orderID);
    }

    @Override
    public void addOrderProducts(OrderProducts orderProducts) {
        orderMapper.addOrderProducts(orderProducts);
    }

    @Override
    public void deleteOrderProducts(DeleteOrderProductsFrom orderProducts) {
        orderMapper.deleteOrderProducts(orderProducts);
    }

    @Override
    public void addOrder(Order order) {
        orderMapper.addOrder(order);
    }

    @Override
    public int getLastInsertedOrderId() {
        // 获取最后一个插入的订单 ID
        // 这里是一个假设的实现，你需要根据你的数据库和查询条件来修改它
        int lastInsertedOrderId = orderMapper.getLastInsertedOrderId();
        return lastInsertedOrderId;
    }

    @Override
    public Order queryOrder(Short id) {

        return orderMapper.queryOrder(id);
    }
}
